package com.bw.db.room.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.bw.db.room.entity.UserInfoEntity

/**
 * 用户信息的操作Dao,提供CRUD
 */
@Dao
interface UserInfoDao {
    @Insert
    suspend fun insertUserInfo(vararg user:UserInfoEntity)//vararg表示可以接收多个实体，相当于Java中“...”

    @Delete
    suspend fun deleteUserInfo(vararg user:UserInfoEntity)

    @Update
    suspend fun updateUserInfo(vararg user:UserInfoEntity)

    @Query("select * from user_info where user_id=:userId")//参数前边必须带冒号
    suspend fun queryUserInfoBy(userId:Int):UserInfoEntity

    @Query("select * from user_info order by user_id")
    suspend fun queryAllUserInfo():List<UserInfoEntity>


}